Random harvest
The Little Book of C: A 100-step journey to learn C from first principles
Sharing large files P2P
❧ 2025-10-05
The Little Book of C: A 100-step journey to learn C from first principles
Sharing large files P2P
❧ 2025-10-05
- "Three modes of operation:
- Copy - download new photos from iCloud (default mode)
- Sync - download new photos from iCloud and delete local files that were removed in iCloud (
--auto-delete
option)- Move - download new photos from iCloud and delete photos in iCloud (
--keep-icloud-recent-days
option)- Support for Live Photos (image and video as separate files) and RAW images (including RAW+JPEG)
- Automatic de-duplication of photos with the same name
- One time download and an option to monitor for iCloud changes continuously (
--watch-with-interval
option)- Optimizations for incremental runs (
--until-found
and--recent
options)- Photo metadata (EXIF) updates (
--set-exif-datetime
option)- ... and many more (use
--help
option to get full list)"
❧ 2025-10-02
osascript -e 'tell application "Finder" to get POSIX path of (get desktop picture as alias)'
defaults write -g com.apple.swipescrolldirection -bool false
❧ 2025-09-30
Boomaga: Virtal printer with booklet option. Easiest of all in limited testing. Configure→Settings→Printer has duplexer→Flip on short edge. FOSS.
pdfbook2: "Create print-ready PDF files from some INPUT PDF files for booklet printing." FOSS.
BookletImposer / pdfimposer: "Basic imposition on PDF documents, especially designed to work on booklets." FOSS.
Print a booklet: Manual instructions from Ubuntu. FOSS.
Preview: Some duplex-capable printers offer "Print As Booklet" at the bottom of the print dialog's Layout → Pages per Sheet drop-down. Free.
Create Booklet 2: "Puts your pages side by side re-sorted for booklet printing, no matter what printer you have." $19.99.
Bookbinder JS: "A Javascript-based app for formatting PDFs for bookbinding—a process called imposition." FOSS.
PDF Snake: "Prepress software for performing document imposition." Subscription/limited freeware: "Users with neither an active free trial nor an active subscription can download one file from PDFSnake.app every 8 hours."
PDF Booklet: "Create booklets from existing PDF files." Linux/Windows. FOSS.
PrintDF: "Small program which creates printable booklets from PDF documents." Java/Windows. FOSS.
BookletCreator: "Reorders pages so that after printing and folding the pages, a small book is created." macOS/Windows. $19.95.
Adobe Acrobat: "Printing a multipage document as a booklet is possible with Acrobat or Reader, which arranges two pages per sheet. After collating, folding, and stapling the double-sided sheets, you'll have a booklet with the pages in the right order." macOS/Windows. Subscription (Acrobat) / free (Reader).
❧ 2025-09-30
Save the following CSS and set it as a custom style sheet in Safari → Settings… → Advanced:
@media (prefers-color-scheme: dark) {
body:empty {background-color: #161616;}}
@media (prefers-color-scheme: light) {
body:empty {background-color: #FFFFF;}}
Thanks to u/torsteinvin & u/Willing-Resource-295 for the fix.
❧ 2025-09-25
Linux Mint Cinnamon prompts with "Run in Terminal | Display | Cancel | Run" when opening txt files; fix by opening Nemo → Edit → Preferences → Behavior → Executable Text Files and setting it to View executable text files when they are opened.
.\setupprep.exe /product server
in PowerShell from ISO's sources
directorylogin adminusername
Upscaling images offline:
Upscayl is an open-source, cross-platform Electron app that "lets you enlarge and enhance low-resolution images using advanced AI algorithms."
Pixelmator Pro's Super Resolution (Image → Super Resolution) "harnesses the power and intelligence of machine learning to upscale photos while preserving and even recreating visually important details. The Super Resolution algorithm is trained to analyze the patterns and textures in a photo instead of interpolating the values of pixels mathematically as done by the regular scaling algorithms."
"Now, researchers at the Netherlands Forensic Institute (NFI) have developed a method that adds biological authentication to this arsenal, detecting deepfakes by analysing blood flow patterns in human faces – patterns that current deepfake generation tools cannot yet replicate."
"Current algorithms for the detection of deepfakes increasingly rely on remote pulse reading to distinguish them from genuine videos of people. Here, scientists show for the first time that the most recent deepfakes feature a global pulse rate which appears realistic. This worrying development makes it necessary for deepfake detectors to become more powerful, for example, by focusing on local variations in blood flow within the face."
Remap macOS keys natively via hidutil:
❧ 2025-09-17
❧ 2025-09-17
Attempting to install macOS 26 Tahoe in UTM on a macOS 15 Sequoia host returned:
Error
A software update is required to complete the installation. Installation requires a software update.
In some cases, the following window would also appear:
A software update is required to install macOS in a virtual machine.
Would you like to download and install this update now?
Use of this software is subject to the original Software License Agreements) that accompanied the software being updated.
Learn More… | Not Now | Install
Clicking "Install" resulted in:
Installation failed
Can't install the software because it is not currently available from the Software Update server.
Preferred updating "Device Support for macOS 26"/"Mobile Device Support" to installing a new version of Xcode, but it was missing from developer.apple.com. Expected that it must be in the Xcode installer:
Downloaded Xcode_26_Release_Candidate_Apple_silicon.xip
Unpacked with unxip (2-3x faster than Archive Utility)
Searched for "Mobile*" under Xcode.app/Contents/
via Find Any File, unearthing MobileDevice.pkg
in Xcode.app/Contents/Resources/Packages/
After running MobileDevice.pkg
(13897894 bytes, SHA256: 305ddeb575c7f85e76f83c1fd5d20d0de34538bb9a61113db041fb4deab12363), Tahoe installation in UTM proceeded normally (searching online for MobileDevice.pkg
confirmed it had worked for others as well)
❧ 2025-09-15
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 0 && defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 0 && killall ControlCenter
defaults -currentHost delete -globalDomain NSStatusItemSpacing && defaults -currentHost delete -globalDomain NSStatusItemSelectionPadding && killall ControlCenter
Reduce menu bar icon spacing to fit more icons
Hidden preference to alter the menubar spacing
Ice: "Powerful menu bar manager for macOS"
TighterMenubar: Allows "customizing menu bar item spacing and padding to create a more compact menu bar layout"
Menu Bar Spacing: "Customize the gap between menu bar items"
❧ 2025-09-08
There have been a host of macOS utilities over the years that remove macOS hidden system and metadata files from external drives in order to prevent compatibility issues on devices like MP3 players, car stereos, etc.:
CleanEject: "Remove unwanted hidden files on USB-sticks, cameras, GPSses and other devices"
Eject-for-Windows (GH): "Remove hidden files from removable storages"
CleanAndEject: "Will clean most of the OSX created dot files that pollute every removable drive you plug into your Mac"
CleanMyDrive: "Automatically clean hidden junk from external drives" (now bundled into CleanMyMac)
Hidden Cleaner: Removes macOS 'ghost' files from devices like MP3 players and USB drives before ejecting them, preventing playback errors and compatibility issues
HiM (Hidden Cleaner iMproved): "Cleans and ejects USB devices like MP3 players, USB sticks... (and also local folders)"
USBclean: "Quickly and easily remove pesky junk and ghost files from your external USB drives"
BlueHarvest: "Removes .DS_Store and ._ AppleDouble files from your USB keys, SD cards, music players, file servers or any non Mac disk"
Hidden File Cleaner: "Ensures annoying hidden files don't clutter your drives"
The developer of CleanEject kindly posted a Bash script that does the job admirably (tested in macOS Sequoia):
#!/bin/bash
if [ -d "$1/.Spotlight-V100" ]; then
dot_clean -m "$1"
find "$1" -name .DS_Store -o -name .apdisk -delete
rm -rf "$1/.Trashes"
rm -rf "$1/.Spotlight-V100"
rm -rf "$1/.fseventsd"
rm -rf "$1/.TemporaryItems"
hdiutil unmount "$1"
fi
Here's a slightly modified version that does not require .Spotlight-V100
to be present, fixes .DS_Store
deletion, and uses a safer eject method:
#!/bin/bash
if [ -d "$1" ]; then
dot_clean -m "$1"
find "$1" \( -name .DS_Store -o -name .apdisk \) -type f -delete
rm -rf "$1"/{.Trashes,.Spotlight-V100,.fseventsd,.TemporaryItems}
diskutil eject "$1"
fi
The modified version wrapped in AppleScript for a simple GUI volume chooser (assuming the user can be trusted not to select Macintosh HD, Time Machine volumes, etc.):
set selectedVolume to choose folder with prompt "Select drive to clean and eject:" default location (POSIX file "/Volumes")
set volumePath to POSIX path of selectedVolume
do shell script "
if [ -d '" & volumePath & "' ]; then
dot_clean -m '" & volumePath & "'
find '" & volumePath & "' \\( -name .DS_Store -o -name .apdisk \\) -type f -delete
rm -rf '" & volumePath & "'/{.Trashes,.Spotlight-V100,.fseventsd,.TemporaryItems}
diskutil eject '" & volumePath & "'
fi"
To reduce the risk of mishap, this final attempt ("One more coruscation, my dear Watson—yet another brain-wave!") processes only FAT and exFAT-formatted volumes:
set selectedVolume to choose folder with prompt "Select drive to clean and eject:" default location (POSIX file "/Volumes")
set volumePath to POSIX path of selectedVolume
-- Only allow FAT family and exFAT
set fsType to do shell script "diskutil info -plist " & quoted form of volumePath & " | plutil -extract FilesystemType raw -"
if fsType is not in {"msdos", "exfat", "fat16", "fat32"} then
display alert "Unsupported Volume" message "Only FAT16, FAT32 and exFAT volumes are supported for safety" buttons {"OK"} default button "OK"
return
end if
-- Clean the volume
do shell script "
dot_clean -m " & quoted form of volumePath & " 2>/dev/null || true
find " & quoted form of volumePath & " \\( -name .DS_Store -o -name .apdisk \\) -type f -delete 2>/dev/null || true
rm -rf " & quoted form of volumePath & "/.Trashes " & quoted form of volumePath & "/.Spotlight-V100 " & quoted form of volumePath & "/.fseventsd " & quoted form of volumePath & "/.TemporaryItems 2>/dev/null || true
"
-- Eject
try
do shell script "diskutil eject " & quoted form of volumePath
on error
display alert "Eject Failed" message "Cleaning completed but eject failed" buttons {"OK"} default button "OK"
end try
Save either AppleScript script in Script Editor via File → Export... → File Format: Application → Code sign: Sign to Run Locally, then grant Accessibility and Full Disk Access permissions in System Settings/Privacy & Security.
Using File → Save... → File Format: Application instead or not granting the necessary permissions will prevent the app from removing .Trashes
and .Spotlight-V100
.
Script Editor sometimes failed to generate Contents/_CodeSignature/CodeResources
inside the exported app, preventing proper handling of .Trashes
and .Spotlight-V100
. Toggling Code Sign: to Don't Code Sign then back to Sign to Run Locally before saving resolved the issue.
TCC permissions occasionally failed despite valid entitlements and pre-approved access, blocking deletion of .Trashes
and .Spotlight-V100
; renaming the exported app and re-granting permissions resolved the issue.
Why are my Applescript scripts executing in ScriptEditor but not as an application?
How can I get my script exported as an app to stop asking for permissions
❧ 2025-09-01